home *** CD-ROM | disk | FTP | other *** search
/ The Original Shareware 1.1 / The Original Shareware (WeMake CDs)(Volume 1.1)(CDs, Inc)(1993).iso / 6 / coreaids.zip / MULT_EXE.ASM < prev    next >
Assembly Source File  |  1987-06-26  |  4KB  |  132 lines

  1. ;    DESC:    Performs repeated executions of a program on a       V1.00
  2. ;        set of files
  3. ;    IN:    *d:\path1\path2\...filename.ext is the name of the program
  4. ;         to be executed
  5. ;        *d:\path1\path2\...filename.ext with wildcards allowed
  6. ;         and is the set of files on which to operate the program
  7. ;    OUT:    *repeated executions of the programs.
  8. ;    SAMPLE:    MULT_EXE program *.ASM {run the program on all files
  9. ;        with a .ASM extension}
  10. ;    ####################################################################
  11.  
  12. MULT_EXD Segment Para Public 'DATA'
  13.         DW    0            ;help message.
  14.         DW    0
  15.         DD    MHELP
  16.         DW    EHELP
  17. MHELP        DB    0DH,0AH,'               '
  18.         DB    'DESC:   Performs repeated executions of a program'
  19.         DB    0DH,0AH,'               '
  20.         DB    'on a set of files'
  21.         DB    0DH,0AH,'               '
  22.         DB    'IN:     *d:\path1\path2\...filename.ext is the name'
  23.         DB    0DH,0AH,'               '
  24.         DB    'of the program to be executed'
  25.         DB    0DH,0AH,'               '
  26.         DB    '*d:\path1\path2\...filename.ext with wildcards'
  27.         DB    0DH,0AH,'               '
  28.         DB    'allowed and is the set of files on which to operate'
  29.         DB    0DH,0AH,'               '
  30.         DB    'the program'
  31.         DB    0DH,0AH,'               '
  32.         DB    'OUT:    *repeated executions of the programs.'
  33.         DB    0DH,0AH,'               '
  34.         DB    'SAMPLE: MULT_EXE program *.ASM {run the program on'
  35.         DB    0DH,0AH,'               '
  36.         DB    'all files with a .ASM extension}'
  37.         DB    0DH,0AH,'               '
  38. EHELP        DB    0
  39.  
  40. PAR        DB    0            ;parameter block.
  41.         DB    20H
  42. PAR2        DB    50 Dup(0DH)        ;filename.
  43.  
  44. TOP        DW    0
  45.  
  46. MULT_EXD Ends
  47.  
  48.     Extrn    SRCH_FIL:Near            ;locate files matching the
  49.                         ;search string.
  50.     Extrn    SRCH_NXT:Near            ;searches for next match.
  51.     Extrn    ERRORMSG:Near            ;prints error exit messages.
  52.     Extrn    EXECUTE:Near            ;executes other program.
  53.     Extrn    MOVE_BYT:Near            ;moves data place to place.
  54.     Extrn    PARM_BRK:Near            ;separates parameters.
  55.     Extrn    HELP:Near            ;provides help information.
  56.  
  57. MULT_EXC    Segment Para Public 'CODE'
  58.     Assume CS:MULT_EXC,DS:MULT_EXD
  59.  
  60.     Include    CALLM.MAC            ;macro file which allows
  61.                         ;input and output of
  62.                         ;parameters to subroutines.
  63.     DW    0,0,0,180,0,0,0
  64.  
  65.                         ;notice.
  66.     DB    'MULT_EXE - V1.00, Copyright 1987, CoreTechs   ',0DH,0AH
  67.  
  68. MULT_EXE    Proc    Far            ;main procedure.
  69.  
  70.     Push    DS                ;store return address.
  71.     Xor    AX,AX
  72.     Push    AX
  73.  
  74.     Mov    BX,DS                ;save initial data segment.
  75.  
  76.     Mov    AX,MULT_EXD            ;assign data segment location.
  77.     Mov    DS,AX
  78.  
  79.     Mov    TOP,BX
  80.  
  81.     Callm    HELP,<BX,AX>,<ES,BX,CX>        ;get DOS data line
  82.                         ;specifying program to
  83.                         ;execute repeatedly.
  84.  
  85.     Callm    PARM_BRK,<ES,BX,CX>,<CX>    ;break up multiple params.
  86.  
  87.     Cmp    CX,2                ;if two params., OK.
  88.     Jz    CONT0
  89.  
  90.     Callm    ERRORMSG,<22>,            ;wrong number of params.
  91.  
  92. CONT0:    Pop    ES                ;recover second param.
  93.     Pop    BX
  94.     Pop    CX
  95.  
  96.     Mov    CX,20H                ;locate first filename.
  97.     Callm    SRCH_FIL,<ES,BX>,<AX,AX,AX,AX,ES,BX,CX>
  98.     Jcxz    ERROR1                ;exit if no matching files.
  99.     Jmp    CONT1
  100.  
  101. ERROR1:    Callm    ERRORMSG,<2>,            ;display no File(s) found.
  102.  
  103. CONT1:    Pop    SI                ;recover name of program
  104.     Pop    DI                ;to run on file in first
  105.     Pop    AX                ;parameter.
  106.  
  107. CONT2:                        ;move filename to internal
  108.                         ;buffer.
  109.     Callm    MOVE_BYT,<ES,BX,DS,<OFFSET PAR2>,CX>,
  110.  
  111.     Inc    CL                ;move parameter length
  112.     Mov    PAR,CL                ;to start of block.
  113.     Dec    CL
  114.  
  115.     Add    CX,OFFSET PAR2            ;setup end of param. block.
  116.     Mov    BP,CX
  117.     Mov    DS:BYTE PTR[BP],0DH
  118.  
  119.                         ;execute program.
  120.     Callm    EXECUTE,<SI,DI,DS,<OFFSET PAR>,TOP,500>,
  121.  
  122.     Mov    CX,20H                ;locate first filename.
  123.     Callm    SRCH_NXT,<ES,BX>,<AX,AX,AX,AX,ES,BX,CX>
  124.     Jcxz    ERROR2                ;exit if no more files.
  125.     Jmp    CONT2                ;return to start of loop.
  126.  
  127. ERROR2:    Callm    ERRORMSG,<18>,            ;display no More Files(s).
  128.  
  129. MULT_EXE    Endp
  130. MULT_EXC    Ends
  131.     End    MULT_EXE
  132.